using System;
using Science.Mathematics;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter31
{
	/// <summary>
	/// Example01: One Way to Induce an emf in a Coil
	/// A coil consists of 200 turns of wire. Each turn is a 
	/// square of side 18 cm, and a uniform magnetic field directed 
	/// perpendicular to the plane of the coil is turned on. If 
	/// the field changes linearly from 0 to 0.50 T in 0.80 s, what 
	/// is the magnitude of the induced emf in the coil while the 
	/// field is changing?
	/// </summary>
	public class Example01
	{
		public Example01()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Time t = new L.Time();
			t.s = 0.0;
		
			L.Scalar.FunctionOfTime func = new L.Scalar.FunctionOfTime(f);
            L.MagneticFlux Phi = new L.MagneticFlux();
            Phi.ScalarFunctionOfTime = func;

			L.ElectricPotentialDifference V =
				new L.ElectricPotentialDifference(Phi,t);

        	result+=Convert.ToString(200.0*V.V)+" \r\n";
		}
		private L.Scalar f(L.Time t)
		{
            L.Scalar s = new L.Scalar();
            s.Magnitude = 0.0162*t.s;
            return s;
		}
	}
}
